package com.huyun.web.FutureTest;

import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletableFuture;

/**
 * @program:
 * @description:
 * @author: hyq
 * @create: 2021-12-30 14:43
 */
public class ThenAcceptTest {
    /**
     * thenAccept结果处理：thenApply也可以归类为对结果的处理，thenAccept和thenApply的区别就是没有返回值 提供了三个方法：
     */
    public static void main(String[] args) {
        //将前一个CompletableFuture计算出来的结果打印出来
        CompletableFuture.supplyAsync(ThenAcceptTest::getList).thenAccept(strList -> strList.stream()
                .forEach(m -> System.out.println(m)));
    }

    public static List<String> getList() {
        WaterMarkUtils.getImg();
        return Arrays.asList("a", "b", "c");
    }
    public static void getImg(){
        WaterMarkUtils.getImg();
    }

}
